home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1998 October / Macworld (1998-10).dmg / Serious Demos / Morpha / 3DO.DXR / 00007_sendmail.ls < prev    next >
Encoding:
Text File  |  1998-07-31  |  1.1 KB  |  26 lines

  1. on sendmail
  2.   set addressString to "iclay@100percent.org"
  3.   set subjectString to urlEncode("3d stuff")
  4.   set messageString to urlEncode("All comments warmly welcome. Ian Clay, (Director), Trees Ltd")
  5.   gotoNetPage("mailto:" & addressString & "?subject=" & subjectString & "&body=" & messageString)
  6. end
  7.  
  8. on urlEncode whichString
  9.   if not stringp(whichString) then
  10.     exit
  11.   end if
  12.   set reservedListASCII to [32, 123, 125, 124, 92, 94, 126, 91, 93, 39, 35, 37, 60, 62, 34, 59, 44, 47, 63, 58, 64, 61, 38, 13]
  13.   set replaceList to ["%20", "%7B", "%7D", "%7C", "%5C", "%5E", "%7E", "%5B", "%5D", "%27", "%23", "%25", "%3C", "%3E", "%22", "%3B", "%2C", "%2F", "%3F", "%3A", "%40", "%3D", "%26", "%0D"]
  14.   set sLength to the number of chars in whichString
  15.   repeat with i = 1 to sLength
  16.     set currentChar to charToNum(char i of whichString)
  17.     set replaceLoc to getOne(reservedListASCII, currentChar)
  18.     if replaceLoc then
  19.       put getAt(replaceList, replaceLoc) into char i of whichString
  20.       set i to i + 2
  21.       set sLength to sLength + 2
  22.     end if
  23.   end repeat
  24.   return whichString
  25. end
  26.